package sqlanalysisgui.editor;

import org.apache.log4j.Logger;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.part.MultiPageEditorPart;

public class DashboardMultiPage extends MultiPageEditorPart {

	public static final String ID = "sqlanalysisgui.editor.DashboardMultiPage"; //$NON-NLS-1$
	private Logger logger =  Logger.getLogger(this.getClass());
	private DashboardTableInput input;
	
	public DashboardMultiPage() {
	}

	@Override
	public void init(IEditorSite site, IEditorInput input)
			throws PartInitException {
		// Initialize the editor part
		
		logger.debug("site: " + site);
		logger.debug("site.getId: " + site.getId());
		logger.debug("input: " + input);
		
		if (!(input instanceof DashboardTableInput)) {
			throw new RuntimeException("Wrong input");
		}

		this.input = (DashboardTableInput) input;
		setSite(site);
		setInput(input);
		//proejctInfo = MyModel.getInstance().getPersonById(this.input.getId());
		//setPartName("Person ID: " + proejctInfo.getId());		
		setPartName(this.input.getProjectInfo().getProjectName());		
		
	}
	
	@Override
	protected void createPages() {
		try {
			setPageText(addPage(new DashboardTable(), input), "표");
			setPageText(addPage(new DashboardGraph(), input), "차트");
			setPageText(addPage(new DashboardModeling(), input), "그래프 노드");
			//setPageText(addPage(new GraphNodeTestEditor(), input), "그래프 노드 테스트");
			
		} catch (PartInitException e) {
		}
	}

	@Override
	public boolean isSaveAsAllowed() {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public void doSave(IProgressMonitor monitor) {
		// TODO Auto-generated method stub
	}

	@Override
	public void doSaveAs() {
		// TODO Auto-generated method stub
	}

}
